class Solution
{
public:
    bool judgeCircle(string moves)
    {
        if (moves.size() & 1)
        {
            return false;
        }
        int xMove = 0;
        int yMove = 0;
        for (char c : moves)
        {
            switch (c)
            {
            case 'R':
            {
                --xMove;
                break;
            }
            case 'L':
            {
                ++xMove;
                break;
            }
            case 'U':
            {
                ++yMove;
                break;
            }
            case 'D':
            {
                --yMove;
                break;
            }
            default:
            {
            }
            }
        }
        return xMove == 0 && yMove == 0;
    }
};